package Euler146;

import java.util.*;

import ReusableCode.PrimeFunctions;;

public class PrimePattern {
	public static void main(String[] args) {
		List<Long> nums = new ArrayList<Long>();
		long sum = 0;
		
		for(int i = 0; i < 150000000; i+=10)
		{
			nums = getNumbers(i);
			
			if(PrimeFunctions.consecutivePrimes(nums))
			{
				sum += i;
				//System.out.println("number is: " + i + "\n" + nums.toString());
			}
		
			System.out.println(i);
		}
		
		System.out.println("The sum is: " + sum);
	}
	
	public static List<Long> getNumbers(long number)
	{
		List<Long> nums = new ArrayList<Long>();
		int adds[] = new int[]{1,3,7,9,13,27};
		long square = (number * number);
		
		for(int i = 0; i < adds.length; i++)
		{
			nums.add(square + adds[i]);
		}
		
		return nums;
	} 
	
}
